typedef struct {
  double q; //process noise covariance
  double r; //measurement noise covariance
  double x; //value
  double p; //estimation error covariance
  double k; //kalman gain
} kalman_state;

kalman_state kalman_init(float q, float r, float p, float intial_value);

float kalman_update(kalman_state* state, float measurement);
